package com.onpositive.wikidataeditor;

import java.util.ArrayList;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;

import com.onpositive.semantic.ui.workbench.elements.XMLView;

public class PropertyValuesView extends XMLViewWithRecourses {

	public static final String ID = "com.onpositive.wikidataeditor.propertyValuesView";
	

	public PropertyValuesView() {
		super("dlf/property-values.dlf");
		
	}
	
	public void setFocus() {
	}
	
	@Override
	public void createPartControl(Composite parent) {
		super.createPartControl(parent);
		getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(new ISelectionListener() {
			

			@Override
			public void selectionChanged(IWorkbenchPart part, ISelection selection)
			{
				if (selection instanceof IStructuredSelection)
				{
					IStructuredSelection sl=(IStructuredSelection) selection;

					if( part.getTitle().equals("Properties list") )						
						getBinding("Selected").setValue(sl.getFirstElement(), null);
				}
			}
		});
	}
}
